#ifndef __POSITION_H__
#define __POSITION_H__

#include <glib-object.h>

G_BEGIN_DECLS

#define TYPE_POSITION			 (position_get_type ())
#define POSITION(obj)			 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_POSITION, Position))
#define POSITION_CLASS(klass)	 (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_POSITION, PositionClass))
#define IS_POSITION(obj)		 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_POSITION))
#define IS_POSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_POSITION))



enum {
	PAWN = 0,
	KNIGHT,
	BISHOP,
	ROOK,
	KING,
	QUEEN	
};

enum {
	W_PAWN = 0,
	W_KNIGHT,
	W_BISHOP,
	W_ROOK,
	W_KING,
	W_QUEEN,
	B_PAWN,
	B_KNIGHT,
	B_BISHOP,
	B_ROOK,
	B_KING,
	B_QUEEN,
	NOPIECE
};

typedef struct _Position        Position;
typedef struct _PositionClass   PositionClass;


struct _PositionClass {
	GObjectClass parent_class;
};

struct _Position {
	GObject parent;
	gint squares[8][8]; // for different square colors
	gint pieces_map[10][8]; //for pieces on board/buffer
	gint premove_map[10][8]; //for premoves/moves ??
	gint arrow_map[10][8]; //for arrows
};

enum {
	M_REGULAR = 0,
	M_KCASTLE,
	M_QCASTLE,
	M_DROP,
	M_PROMOTE,
	M_CAPTURE
};

typedef struct {
	gint from_file, from_rank;
	gint to_file, to_rank;
	gint captured_piece;
	gint piece;
	gint promote_to;
	int type;
} Move;

GType    position_get_type	(void) G_GNUC_CONST;
Position *position_new		(void);
void position_print_fen (Position *pos);
void position_print (Position *pos);
void position_do_move (Position *pos, Move *mov);

G_END_DECLS

#endif
